///***********************************************************************************************************************
// 文 件 名: Example_GPIO.c
// 功    能: 输入输出测试
//
//
//
// 作    者：zhangzj
// 创建时间: 2024.03.18
//
// 日    志：
// [2024.03.18] 创建。
//***********************************************************************************************************************/
#include "NL8507.h"
#include "AES.h"


const unsigned char code plain_text[16] = {
  0x00,0x11,0x22,0x33,
  0x44,0x55,0x66,0x77,
  0x88,0x99,0xAA,0xBB,
  0xCC,0xDD,0xEE,0xFF
};
const unsigned char code key_text[16] = {
  0x00,0x01,0x02,0x03,
  0x04,0x05,0x06,0x07,
  0x08,0x09,0x0A,0x0B,
  0x0C,0x0D,0x0E,0x0F
};

//const unsigned char code ciphered_code [16] = {
//    0x69,  0xC4,  0xE0,  0xD8,
//    0x6A,  0x7B,  0x04,  0x30,
//    0xD8,  0xCD,  0xB7,  0x80,
//    0x70,  0xB4,  0xC5,  0x5A
//  };
//======================================================================================================================
// 名称：main
// 功能：
//
void main(void)
{
  char i;
  unsigned char *srcp;
  unsigned char  data ciphered [16];
  unsigned char  data original [16];
  
  ////1.关狗
	WDTCN = 0x08;
	PCON0 = 0x30;
  
  
  AES_Init();
  srcp = AES_Encryption(plain_text,key_text,1);
  for(i=0;i<16;i++){
    ciphered[i] = *(srcp+i);
  }
  srcp = AES_Decryption(ciphered,key_text,1);
  for(i=0;i<16;i++){
    original[i] = *(srcp+i);
  }
  while(1);

}
